Use gdk_threads_add_idle. Bug #504571.
authorChristian Persch <chpe@src.gnome.org>
Sat, 22 Dec 2007 20:18:13 +0000 (20:18 +0000)
committerChristian Persch <chpe@src.gnome.org>
Sat, 22 Dec 2007 20:18:13 +0000 (20:18 +0000)
svn path=/trunk/; revision=19222

19 files changed:
ChangeLog
modules/other/gail/gail.c
modules/other/gail/gailbutton.c
modules/other/gail/gailcell.c
modules/other/gail/gailcombo.c
modules/other/gail/gailcombo.h
modules/other/gail/gailcombobox.c
modules/other/gail/gailentry.c
modules/other/gail/gailexpander.c
modules/other/gail/gailmenuitem.c
modules/other/gail/gailnotebook.c
modules/other/gail/gailnotebookpage.c
modules/other/gail/gailnotebookpage.h
modules/other/gail/gailoptionmenu.c
modules/other/gail/gailrange.c
modules/other/gail/gailtextview.c
modules/other/gail/gailtreeview.c
modules/other/gail/gailtreeview.h
modules/other/gail/gailwindow.c

index 5804ad0809fbf4c75b41cb5a93b3606e392400d0..e80b04fd32d7c6d70ad6cb2467114bf9558952bc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2007-12-22  Christian Persch  <chpe@gnome.org>
+        
+        * modules/other/gail/gail.c:
+        * modules/other/gail/gailbutton.c:
+        * modules/other/gail/gailcell.c:
+        * modules/other/gail/gailcombo.c:
+        * modules/other/gail/gailcombo.h:
+        * modules/other/gail/gailcombobox.c:
+        * modules/other/gail/gailentry.c:
+        * modules/other/gail/gailexpander.c:
+        * modules/other/gail/gailmenuitem.c:
+        * modules/other/gail/gailnotebook.c:
+        * modules/other/gail/gailnotebookpage.c:
+        * modules/other/gail/gailnotebookpage.h:
+        * modules/other/gail/gailoptionmenu.c:
+        * modules/other/gail/gailrange.c:
+        * modules/other/gail/gailtextview.c:
+        * modules/other/gail/gailtreeview.c:
+        * modules/other/gail/gailtreeview.h:
+        * modules/other/gail/gailwindow.c: Use gdk_threads_add_idle.
+        Bug #504571.
+
 2007-12-22  Matthias Clasen  <mclasen@redhat.com>
 
        * modules/other/gail/gailclist.c: Chain up the finalizer (#504570,
index 217eb8caaefd91445962e458ea113668ea3cf2af..3fcbd4c211917fe45c200d38a10e316e14ae61ed 100644 (file)
@@ -509,12 +509,9 @@ gail_switch_page_watcher (GSignalInvocationHint *ihint,
   return TRUE;
 }
 
-
-static gint
+static gboolean
 gail_focus_idle_handler (gpointer data)
 {
-  GDK_THREADS_ENTER();
-
   focus_notify_handler = 0;
   /*
    * The widget which was to receive focus may have been removed
@@ -522,10 +519,7 @@ gail_focus_idle_handler (gpointer data)
   if (!next_focus_widget)
     {
       if (next_focus_widget != data)
-       {
-         GDK_THREADS_LEAVE ();
-         return FALSE;
-       }
+        return FALSE;
     }
   else
     {
@@ -536,8 +530,7 @@ gail_focus_idle_handler (gpointer data)
     
   gail_focus_notify (data);
 
-  GDK_THREADS_LEAVE ();
-  return FALSE; 
+  return FALSE;
 }
 
 static void
@@ -656,7 +649,7 @@ gail_focus_notify_when_idle (GtkWidget *widget)
         }
     }
 
-  focus_notify_handler = g_idle_add (gail_focus_idle_handler, widget);
+  focus_notify_handler = gdk_threads_add_idle (gail_focus_idle_handler, widget);
 }
 
 static gboolean
index 46b7db33a856e217ffa6ee7c666302275f3050f5..3ac2ea497f96859b0a62f9428071be516014e982 100644 (file)
@@ -547,7 +547,7 @@ gail_button_do_action (AtkAction *action,
        }
       g_queue_push_head (button->action_queue, (gpointer) i);
       if (!button->action_idle_handler)
-       button->action_idle_handler = g_idle_add (idle_do_action, button);
+       button->action_idle_handler = gdk_threads_add_idle (idle_do_action, button);
       break;
     default:
       return_value = FALSE;
@@ -564,8 +564,6 @@ idle_do_action (gpointer data)
   GailButton *gail_button;
   GdkEvent tmp_event;
 
-  GDK_THREADS_ENTER ();
-
   gail_button = GAIL_BUTTON (data);
   gail_button->action_idle_handler = 0;
   widget = GTK_ACCESSIBLE (gail_button)->widget;
@@ -578,10 +576,7 @@ idle_do_action (gpointer data)
   
   if (widget == NULL /* State is defunct */ ||
       !GTK_WIDGET_IS_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget))
-    {
-      GDK_THREADS_LEAVE ();
-      return FALSE;
-    }
+    return FALSE;
   else
     gtk_widget_event (widget, &tmp_event);
 
@@ -627,9 +622,7 @@ idle_do_action (gpointer data)
        }
     }
 
-  GDK_THREADS_LEAVE ();
-
-  return FALSE; 
+  return FALSE;
 }
 
 static gint
index 6848631863b3d22034f8836cce4325a93d97274d..f9f0ab4d46241474409415b7432bc3a56d69f218 100644 (file)
@@ -510,7 +510,7 @@ gail_cell_action_do_action (AtkAction *action,
   if (cell->action_idle_handler)
     return FALSE;
   cell->action_func = info->do_action_func;
-  cell->action_idle_handler = g_idle_add (idle_do_action, cell);
+  cell->action_idle_handler = gdk_threads_add_idle (idle_do_action, cell);
   return TRUE;
 }
 
@@ -519,14 +519,10 @@ idle_do_action (gpointer data)
 {
   GailCell *cell;
 
-  GDK_THREADS_ENTER ();
-
   cell = GAIL_CELL (data);
   cell->action_idle_handler = 0;
   cell->action_func (cell);
 
-  GDK_THREADS_LEAVE ();
-
   return FALSE;
 }
 
index 45d6ade37e20ee2c858d5f057d379d692a268a2e..c99a0f6b1426628d377b295e61883f4a4b3f8344 100644 (file)
@@ -187,16 +187,12 @@ notify_deselect (gpointer data)
 {
   GailCombo *combo;
 
-  GDK_THREADS_ENTER ();
-
   combo = GAIL_COMBO (data);
 
   combo->old_selection = NULL;
   combo->deselect_idle_handler = 0;
   g_signal_emit_by_name (data, "selection_changed");
 
-  GDK_THREADS_LEAVE ();
-
   return FALSE;
 }
 
@@ -205,15 +201,11 @@ notify_select (gpointer data)
 {
   GailCombo *combo;
 
-  GDK_THREADS_ENTER ();
-
   combo = GAIL_COMBO (data);
 
   combo->select_idle_handler = 0;
   g_signal_emit_by_name (data, "selection_changed");
 
-  GDK_THREADS_LEAVE ();
-
   return FALSE;
 }
 
@@ -240,7 +232,7 @@ gail_combo_selection_changed_gtk (GtkWidget      *widget,
         {
           gail_combo->old_selection = slist->data;
           if (gail_combo->select_idle_handler == 0)
-            gail_combo->select_idle_handler =  g_idle_add (notify_select, gail_combo);
+            gail_combo->select_idle_handler = gdk_threads_add_idle (notify_select, gail_combo);
         }
       if (gail_combo->deselect_idle_handler)
         {
@@ -251,7 +243,7 @@ gail_combo_selection_changed_gtk (GtkWidget      *widget,
   else
     {
       if (gail_combo->deselect_idle_handler == 0)
-        gail_combo->deselect_idle_handler =  g_idle_add (notify_deselect, gail_combo);
+        gail_combo->deselect_idle_handler = gdk_threads_add_idle (notify_deselect, gail_combo);
       if (gail_combo->select_idle_handler)
         {
           g_source_remove (gail_combo->select_idle_handler);
@@ -344,7 +336,7 @@ gail_combo_do_action (AtkAction *action,
       if (combo->action_idle_handler)
         return FALSE;
 
-      combo->action_idle_handler = g_idle_add (idle_do_action, combo);
+      combo->action_idle_handler = gdk_threads_add_idle (idle_do_action, combo);
       return TRUE;
     }
   else
@@ -369,17 +361,12 @@ idle_do_action (gpointer data)
   gboolean do_popup;
   GdkEvent tmp_event;
 
-  GDK_THREADS_ENTER ();
-
   gail_combo = GAIL_COMBO (data);
   gail_combo->action_idle_handler = 0;
   widget = GTK_ACCESSIBLE (gail_combo)->widget;
   if (widget == NULL /* State is defunct */ ||
       !GTK_WIDGET_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget))
-    {
-      GDK_THREADS_LEAVE ();
-      return FALSE;
-    }
+    return FALSE;
 
   combo = GTK_COMBO (widget);
 
@@ -399,6 +386,7 @@ idle_do_action (gpointer data)
 
       gtk_widget_event (action_widget, &tmp_event);
 
+      /* FIXME !*/
       g_idle_add (_gail_combo_button_release, combo);
     }
     else
@@ -409,11 +397,10 @@ idle_do_action (gpointer data)
       action_widget = combo->popwin;
     
       gtk_widget_event (action_widget, &tmp_event);
+      /* FIXME !*/
       g_idle_add (_gail_combo_popup_release, combo);
     }
 
-  GDK_THREADS_LEAVE ();
-
   return FALSE;
 }
 
index 79157af448dca883ce5afb3205f5dc51e6507634..c3e99c7725009894e4fe620e17055deb49138f22 100644 (file)
@@ -42,10 +42,10 @@ struct _GailCombo
 {
   GailContainer parent;
 
+  gpointer      old_selection;
   gchar         *press_description;
-  guint         action_idle_handler;
 
-  gpointer      old_selection;
+  guint         action_idle_handler;
   guint         select_idle_handler;
   guint         deselect_idle_handler;
 };
index 316e719f14fd35e6e4da53c3c673123e08f80004..6083e22fb62cdb531aba1fbf56c8018120140784 100644 (file)
@@ -379,7 +379,7 @@ gail_combo_box_do_action (AtkAction *action,
       if (combo_box->action_idle_handler)
         return FALSE;
 
-      combo_box->action_idle_handler = g_idle_add (idle_do_action, combo_box);
+      combo_box->action_idle_handler = gdk_threads_add_idle (idle_do_action, combo_box);
       return TRUE;
     }
   else
@@ -395,17 +395,12 @@ idle_do_action (gpointer data)
   AtkObject *popup;
   gboolean do_popup;
 
-  GDK_THREADS_ENTER ();
-
   gail_combo_box = GAIL_COMBO_BOX (data);
   gail_combo_box->action_idle_handler = 0;
   widget = GTK_ACCESSIBLE (gail_combo_box)->widget;
   if (widget == NULL || /* State is defunct */
       !GTK_WIDGET_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget))
-    {
-      GDK_THREADS_LEAVE ();
-      return FALSE;
-    }
+    return FALSE;
 
   combo_box = GTK_COMBO_BOX (widget);
 
@@ -416,8 +411,6 @@ idle_do_action (gpointer data)
   else
       gtk_combo_box_popdown (combo_box);
 
-  GDK_THREADS_LEAVE ();
-
   return FALSE;
 }
 
index 4910bc7566820b9e1996dce39bcca6bb13975321..e7fa3dbb22f3d78db8c434c376ab853be4ffa514 100644 (file)
@@ -1067,14 +1067,10 @@ idle_notify_insert (gpointer data)
 {
   GailEntry *entry;
 
-  GDK_THREADS_ENTER ();
-
   entry = GAIL_ENTRY (data);
   entry->insert_idle_handler = 0;
   gail_entry_notify_insert (entry);
 
-  GDK_THREADS_LEAVE ();
-
   return FALSE;
 }
 
@@ -1117,7 +1113,7 @@ _gail_entry_insert_text_cb (GtkEntry *entry,
    * or in an idle handler if it not updated.
    */
    if (gail_entry->insert_idle_handler == 0)
-     gail_entry->insert_idle_handler = g_idle_add (idle_notify_insert, gail_entry);
+     gail_entry->insert_idle_handler = gdk_threads_add_idle (idle_notify_insert, gail_entry);
 }
 
 static gunichar 
@@ -1274,7 +1270,7 @@ gail_entry_do_action (AtkAction *action,
       if (entry->action_idle_handler)
         return_value = FALSE;
       else
-        entry->action_idle_handler = g_idle_add (idle_do_action, entry);
+        entry->action_idle_handler = gdk_threads_add_idle (idle_do_action, entry);
       break;
     default:
       return_value = FALSE;
@@ -1289,22 +1285,15 @@ idle_do_action (gpointer data)
   GailEntry *entry;
   GtkWidget *widget;
 
-  GDK_THREADS_ENTER ();
-
   entry = GAIL_ENTRY (data);
   entry->action_idle_handler = 0;
   widget = GTK_ACCESSIBLE (entry)->widget;
   if (widget == NULL /* State is defunct */ ||
       !GTK_WIDGET_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget))
-    {
-      GDK_THREADS_LEAVE ();
-      return FALSE;
-    }
+    return FALSE;
 
   gtk_widget_activate (widget);
 
-  GDK_THREADS_LEAVE ();
-
   return FALSE;
 }
 
index 8d43e2fdc8f45411b22bea9aaea584c841b21a54..2b90102092b1c3eb8647b3a42cdaafdccaf7dfb1 100644 (file)
@@ -434,7 +434,7 @@ gail_expander_do_action (AtkAction *action,
       if (expander->action_idle_handler)
         return_value = FALSE;
       else
-       expander->action_idle_handler = g_idle_add (idle_do_action, expander);
+       expander->action_idle_handler = gdk_threads_add_idle (idle_do_action, expander);
       break;
     default:
       return_value = FALSE;
@@ -449,24 +449,17 @@ idle_do_action (gpointer data)
   GtkWidget *widget;
   GailExpander *gail_expander;
 
-  GDK_THREADS_ENTER ();
-
   gail_expander = GAIL_EXPANDER (data);
   gail_expander->action_idle_handler = 0;
 
   widget = GTK_ACCESSIBLE (gail_expander)->widget;
   if (widget == NULL /* State is defunct */ ||
       !GTK_WIDGET_IS_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget))
-    {
-      GDK_THREADS_LEAVE ();
-      return FALSE;
-    }
+    return FALSE;
 
   gtk_widget_activate (widget);
 
-  GDK_THREADS_LEAVE ();
-
-  return FALSE; 
+  return FALSE;
 }
 
 static gint
index 0425cae4261796c5b078c074082844b1c98db113..d5dc8f9417dc316f9e8f66ab143e9a49247be6d7 100644 (file)
@@ -311,8 +311,11 @@ gail_menu_item_do_action (AtkAction *action,
         return FALSE;
       else
        {
-         g_object_ref (gail_menu_item);
-         gail_menu_item->action_idle_handler = g_idle_add (idle_do_action, gail_menu_item);
+         gail_menu_item->action_idle_handler =
+            gdk_threads_add_idle_full (G_PRIORITY_DEFAULT_IDLE,
+                                       idle_do_action,
+                                       g_object_ref (gail_menu_item),
+                                       (GDestroyNotify) g_object_unref);
        }
       return TRUE;
     }
@@ -352,18 +355,12 @@ idle_do_action (gpointer data)
   GailMenuItem *menu_item;
   gboolean item_mapped;
 
-  GDK_THREADS_ENTER ();
-
   menu_item = GAIL_MENU_ITEM (data);
   menu_item->action_idle_handler = 0;
   item = GTK_ACCESSIBLE (menu_item)->widget;
   if (item == NULL /* State is defunct */ ||
       !GTK_WIDGET_SENSITIVE (item) || !GTK_WIDGET_VISIBLE (item))
-  {
-    g_object_unref (menu_item);
-    GDK_THREADS_LEAVE ();
     return FALSE;
-  }
 
   item_parent = gtk_widget_get_parent (item);
   gtk_menu_shell_select_item (GTK_MENU_SHELL (item_parent), item);
@@ -376,9 +373,6 @@ idle_do_action (gpointer data)
   if (!item_mapped)
     ensure_menus_unposted (menu_item);
 
-  g_object_unref (menu_item);
-  GDK_THREADS_LEAVE ();
-
   return FALSE;
 }
 
index 1e60ac44af2836439b423e53d1a902def8bad285..d2671542a0a80fa413e4c3c40d256bc872d3b040 100644 (file)
@@ -310,7 +310,7 @@ gail_notebook_real_notify_gtk (GObject           *obj,
         {
           if (gail_notebook->idle_focus_id)
             g_source_remove (gail_notebook->idle_focus_id);
-          gail_notebook->idle_focus_id = g_idle_add (gail_notebook_check_focus_tab, atk_obj);
+          gail_notebook->idle_focus_id = gdk_threads_add_idle (gail_notebook_check_focus_tab, atk_obj);
         }
     }
   else
@@ -337,6 +337,10 @@ gail_notebook_finalize (GObject            *object)
     }
 
   g_list_free (notebook->page_cache);
+
+  if (notebook->idle_focus_id)
+    g_source_remove (notebook->idle_focus_id);
+
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
@@ -593,9 +597,8 @@ gail_notebook_focus_cb (GtkWidget      *widget,
     {
     case GTK_DIR_LEFT:
     case GTK_DIR_RIGHT:
-      if (gail_notebook->idle_focus_id)
-        g_source_remove (gail_notebook->idle_focus_id);
-      gail_notebook->idle_focus_id = g_idle_add (gail_notebook_check_focus_tab, atk_obj);
+      if (gail_notebook->idle_focus_id == 0)
+        gail_notebook->idle_focus_id = gdk_threads_add_idle (gail_notebook_check_focus_tab, atk_obj);
       break;
     default:
       break;
@@ -612,8 +615,6 @@ gail_notebook_check_focus_tab (gpointer data)
   GailNotebook *gail_notebook;
   GtkNotebook *gtk_notebook;
 
-  GDK_THREADS_ENTER ();
-
   atk_obj = ATK_OBJECT (data);
   gail_notebook = GAIL_NOTEBOOK (atk_obj);
   widget = GTK_ACCESSIBLE (atk_obj)->widget;
@@ -623,10 +624,7 @@ gail_notebook_check_focus_tab (gpointer data)
   gail_notebook->idle_focus_id = 0;
 
   if (!gtk_notebook->focus_tab)
-    {
-      GDK_THREADS_LEAVE ();
-      return FALSE;
-    }
+    return FALSE;
 
   old_focus_page_num = gail_notebook->focus_tab_page;
   focus_page_num = g_list_index (gtk_notebook->children, gtk_notebook->focus_tab->data);
@@ -640,8 +638,6 @@ gail_notebook_check_focus_tab (gpointer data)
       g_object_unref (obj);
     }
 
-  GDK_THREADS_LEAVE ();
-
   return FALSE;
 }
 
@@ -651,5 +647,8 @@ gail_notebook_destroyed (gpointer data)
   GailNotebook *gail_notebook = GAIL_NOTEBOOK (data);
 
   if (gail_notebook->idle_focus_id)
-    g_source_remove (gail_notebook->idle_focus_id);
+    {
+      g_source_remove (gail_notebook->idle_focus_id);
+      gail_notebook->idle_focus_id = 0;
+    }
 }
index b830f912ed9c47f2c053f590afa7fbfb9c25160d..4489d76e93b1925774e058262df6a1382a360efe 100644 (file)
@@ -184,12 +184,12 @@ notify_child_added (gpointer data)
   GailNotebookPage *page;
   AtkObject *atk_object, *atk_parent;
 
-  GDK_THREADS_ENTER ();
-
   g_return_val_if_fail (GAIL_IS_NOTEBOOK_PAGE (data), FALSE);
   page = GAIL_NOTEBOOK_PAGE (data);
   atk_object = ATK_OBJECT (data);
 
+  page->notify_child_added_id = 0;
+
   /* The widget page->notebook may be deleted before this handler is called */
   if (page->notebook != NULL)
     {
@@ -198,8 +198,6 @@ notify_child_added (gpointer data)
       g_signal_emit_by_name (atk_parent, "children_changed::add", page->index, atk_object, NULL);
     }
   
-  GDK_THREADS_LEAVE ();
-
   return FALSE;
 }
 
@@ -236,7 +234,7 @@ gail_notebook_page_new (GtkNotebook *notebook,
   atk_object->role = ATK_ROLE_PAGE_TAB;
   atk_object->layer = ATK_LAYER_WIDGET;
 
-  g_idle_add (notify_child_added, atk_object);
+  page->notify_child_added_id = gdk_threads_add_idle (notify_child_added, atk_object);
   /*
    * We get notified of changes to the label
    */
@@ -329,8 +327,10 @@ gail_notebook_page_finalize (GObject *object)
   if (page->textutil)
     g_object_unref (page->textutil);
 
-  G_OBJECT_CLASS (parent_class)->finalize (object);
+  if (page->notify_child_added_id)
+    g_source_remove (page->notify_child_added_id);
 
+  G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
 static G_CONST_RETURN gchar*
index 50af79cfcb5ae8c99cbb623a3c84cc80d3d60882..022f4affc753f5272ec2f239ade55e1eb6099084 100644 (file)
@@ -47,6 +47,7 @@ struct _GailNotebookPage
   GtkNotebookPage *page;
   
   gint index;
+  guint notify_child_added_id;
 
   GailTextUtil *textutil;
 };
index 873e93977054f22ad691e79019741d320623cd31..a78d75c142545ca1517608abcf396cf4ec113111 100644 (file)
@@ -256,7 +256,7 @@ gail_option_menu_do_action (AtkAction *action,
       if (button->action_idle_handler)
         return_value = FALSE;
       else
-        button->action_idle_handler = g_idle_add (idle_do_action, button);
+        button->action_idle_handler = gdk_threads_add_idle (idle_do_action, button);
       break;
     default:
       return_value = FALSE;
@@ -273,18 +273,13 @@ idle_do_action (gpointer data)
   GdkEvent tmp_event;
   GailButton *gail_button;
 
-  GDK_THREADS_ENTER ();
-
   gail_button = GAIL_BUTTON (data);
   gail_button->action_idle_handler = 0;
 
   widget = GTK_ACCESSIBLE (gail_button)->widget;
   if (widget == NULL /* State is defunct */ ||
       !GTK_WIDGET_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget))
-    {
-      GDK_THREADS_LEAVE ();
-      return FALSE;
-    }
+    return FALSE;
 
   button = GTK_BUTTON (widget); 
 
@@ -303,9 +298,7 @@ idle_do_action (gpointer data)
 
   gtk_widget_event (widget, &tmp_event);
 
-  GDK_THREADS_LEAVE ();
-
-  return FALSE; 
+  return FALSE;
 }
 
 static gint
index 2313aeeda708a5dd2379d069d223403bb9700a81..bf6eaa4522da8c3dfc47ba62c028d4c5752d53a4 100644 (file)
@@ -412,7 +412,7 @@ gail_range_do_action (AtkAction *action,
     if (range->action_idle_handler)
       return_value = FALSE;
     else
-      range->action_idle_handler = g_idle_add (idle_do_action, range);
+      range->action_idle_handler = gdk_threads_add_idle (idle_do_action, range);
    }
   else
      return_value = FALSE;
@@ -425,22 +425,15 @@ idle_do_action (gpointer data)
   GailRange *range;
   GtkWidget *widget;
 
-  GDK_THREADS_ENTER ();
-
   range = GAIL_RANGE (data);
   range->action_idle_handler = 0;
   widget = GTK_ACCESSIBLE (range)->widget;
   if (widget == NULL /* State is defunct */ ||
      !GTK_WIDGET_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget))
-   {
-    GDK_THREADS_LEAVE ();
     return FALSE;
-   }
 
    gtk_widget_activate (widget);
 
-   GDK_THREADS_LEAVE ();
-
    return FALSE;
 }
 
index e99e02a1fe43a9d336c9614883461d7460f8e2e6..962ecdf9e968d7010e16ba3f5d8f770e135a9f1a 100644 (file)
@@ -1591,7 +1591,7 @@ _gail_text_view_changed_cb (GtkTextBuffer *buffer,
     {
       if (!gail_text_view->insert_notify_handler)
         {
-          gail_text_view->insert_notify_handler = g_idle_add (insert_idle_handler, accessible);
+          gail_text_view->insert_notify_handler = gdk_threads_add_idle (insert_idle_handler, accessible);
         }
       return;
     }
@@ -1680,8 +1680,6 @@ insert_idle_handler (gpointer data)
   GailTextView *gail_text_view;
   GtkTextBuffer *buffer;
 
-  GDK_THREADS_ENTER ();
-
   gail_text_view = GAIL_TEXT_VIEW (data);
 
   g_signal_emit_by_name (data,
@@ -1703,8 +1701,6 @@ insert_idle_handler (gpointer data)
       gail_text_view->previous_selection_bound = get_selection_bound (buffer);
     }
 
-  GDK_THREADS_LEAVE ();
-
   return FALSE;
 }
 
index ef3e42e076785152b0bef609b88b4882566fc6aa..627ab9275f606e106dd56e06806fba23d3aca889 100644 (file)
@@ -687,7 +687,11 @@ gail_tree_view_finalize (GObject       *object)
 
   /* remove any idle handlers still pending */
   if (view->idle_garbage_collect_id)
-      g_source_remove (view->idle_garbage_collect_id);
+    g_source_remove (view->idle_garbage_collect_id);
+  if (view->idle_cursor_changed_id)
+    g_source_remove (view->idle_cursor_changed_id);
+  if (view->idle_expand_id)
+    g_source_remove (view->idle_expand_id);
 
   if (view->caption)
     g_object_unref (view->caption);
@@ -2299,8 +2303,9 @@ gail_tree_view_expand_row_gtk (GtkTreeView       *tree_view,
    */
   /* this seems wrong since it overwrites any other pending expand handlers... */
   gailview->idle_expand_path = gtk_tree_path_copy (path);
-  if (gailview->idle_expand_id) g_source_remove (gailview->idle_expand_id);
-  gailview->idle_expand_id = g_idle_add (idle_expand_row, gailview);
+  if (gailview->idle_expand_id)
+    g_source_remove (gailview->idle_expand_id);
+  gailview->idle_expand_id = gdk_threads_add_idle (idle_expand_row, gailview);
   return FALSE;
 }
 
@@ -2314,7 +2319,7 @@ idle_expand_row (gpointer data)
   GtkTreeModel *tree_model;
   gint n_inserted, row;
 
-  GDK_THREADS_ENTER ();
+  gailview->idle_expand_id = 0;
 
   path = gailview->idle_expand_path;
   tree_view = GTK_TREE_VIEW (GTK_ACCESSIBLE (gailview)->widget);
@@ -2322,14 +2327,11 @@ idle_expand_row (gpointer data)
   g_assert (GTK_IS_TREE_VIEW (tree_view));
 
   tree_model = gtk_tree_view_get_model(tree_view);
-
-  g_assert (GTK_IS_TREE_MODEL (tree_model));
+  if (!tree_model)
+    return FALSE;
 
   if (!path || !gtk_tree_model_get_iter (tree_model, &iter, path))
-    {
-      GDK_THREADS_LEAVE ();
-      return FALSE;
-    }
+    return FALSE;
 
   /*
    * Update visibility of cells below expansion row
@@ -2358,7 +2360,6 @@ idle_expand_row (gpointer data)
   else
     {
       /* We can get here if the row expanded callback deleted the row */
-      GDK_THREADS_LEAVE ();
       return FALSE;
     }
 
@@ -2380,8 +2381,6 @@ idle_expand_row (gpointer data)
 
   gtk_tree_path_free (path);
 
-  GDK_THREADS_LEAVE ();
-
   return FALSE;
 }
 
@@ -2661,45 +2660,42 @@ columns_changed (GtkTreeView *tree_view)
 static void
 cursor_changed (GtkTreeView *tree_view)
 {
+  GailTreeView *gailview;
+
+  gailview = GAIL_TREE_VIEW (gtk_widget_get_accessible (GTK_WIDGET (tree_view)));
+  if (gailview->idle_cursor_changed_id != 0)
+    return;
+
   /*
    * We notify the focus change in a idle handler so that the processing
    * of the cursor change is completed when the focus handler is called.
    * This will allow actions to be called in the focus handler
    */ 
-  g_idle_add (idle_cursor_changed, gtk_widget_get_accessible (GTK_WIDGET (tree_view)));
+  gailview->idle_cursor_changed_id = gdk_threads_add_idle (idle_cursor_changed, gailview);
 }
 
 static gint
 idle_cursor_changed (gpointer data)
 {
+  GailTreeView *gail_tree_view = GAIL_TREE_VIEW (data);
   GtkTreeView *tree_view;
   GtkWidget *widget;
-  AtkObject *parent;
   AtkObject *cell;
 
-  GDK_THREADS_ENTER ();
+  gail_tree_view->idle_cursor_changed_id = 0;
 
-  parent = ATK_OBJECT (data);
-
-  widget = GTK_ACCESSIBLE (parent)->widget;
+  widget = GTK_ACCESSIBLE (gail_tree_view)->widget;
   /*
    * Widget has been deleted
    */
   if (widget == NULL)
-    {
-      GDK_THREADS_LEAVE ();
-      return FALSE;
-    }
+    return FALSE;
 
   tree_view = GTK_TREE_VIEW (widget);
 
   cell = gail_tree_view_ref_focus_cell (tree_view);
   if (cell)
     {
-      GailTreeView *gail_tree_view;
-
-      gail_tree_view = GAIL_TREE_VIEW (parent);
-
       if (cell != gail_tree_view->focus_cell)
         {
           if (gail_tree_view->focus_cell)
@@ -2711,7 +2707,7 @@ idle_cursor_changed (gpointer data)
 
           if (GTK_WIDGET_HAS_FOCUS (widget))
             gail_cell_add_state (GAIL_CELL (cell), ATK_STATE_ACTIVE, FALSE);
-          g_signal_emit_by_name (parent,
+          g_signal_emit_by_name (gail_tree_view,
                                  "active-descendant-changed",
                                  cell);
         }
@@ -2719,8 +2715,6 @@ idle_cursor_changed (gpointer data)
         g_object_unref (cell);
     }
 
-  GDK_THREADS_LEAVE ();
-
   return FALSE;
 }
 
@@ -2855,13 +2849,14 @@ model_row_inserted (GtkTreeModel *tree_model,
   if (gailview->idle_expand_id)
     {
       g_source_remove (gailview->idle_expand_id);
+      gailview->idle_expand_id = 0;
+
       /* don't do this if the insertion precedes the idle path, since it will now be invalid */
       if (path && gailview->idle_expand_path &&
          (gtk_tree_path_compare (path, gailview->idle_expand_path) > 0))
          set_expand_state (tree_view, tree_model, gailview, gailview->idle_expand_path, FALSE);
       if (gailview->idle_expand_path) 
          gtk_tree_path_free (gailview->idle_expand_path);
-      gailview->idle_expand_id = 0;
     }
   /* Check to see if row is visible */
   row = get_row_from_tree_path (tree_view, path);
@@ -3542,8 +3537,9 @@ clean_cell_info (GailTreeView *gailview,
       cell_info->in_use = FALSE; 
       if (!gailview->garbage_collection_pending) {
          gailview->garbage_collection_pending = TRUE;
+          g_assert (gailview->idle_garbage_collect_id == 0);
          gailview->idle_garbage_collect_id = 
-             g_idle_add (idle_garbage_collect_cell_data, gailview);
+           gdk_threads_add_idle (idle_garbage_collect_cell_data, gailview);
       }
   }
 }
@@ -3648,13 +3644,11 @@ clean_cols (GailTreeView      *gailview,
     }
 }
 
-
 static gboolean
 idle_garbage_collect_cell_data (gpointer data)
 {
       GailTreeView *tree_view;
 
-      GDK_THREADS_ENTER ();
       g_assert (GAIL_IS_TREE_VIEW (data));
       tree_view = (GailTreeView *)data;
 
@@ -3666,9 +3660,7 @@ idle_garbage_collect_cell_data (gpointer data)
 
       tree_view->garbage_collection_pending = garbage_collect_cell_data (data);
 
-      GDK_THREADS_LEAVE ();
-
-      /* N.B.: if for some reason another handler has re-enterantly been queued 
+      /* N.B.: if for some reason another handler has re-enterantly been queued
        * while this handler was being serviced, it has its own gsource, therefore this handler
        * should always return FALSE.
        */
@@ -4105,7 +4097,7 @@ cell_destroyed (gpointer data)
       if (!cell_info->view->garbage_collection_pending) {
          cell_info->view->garbage_collection_pending = TRUE;
          cell_info->view->idle_garbage_collect_id =
-           g_idle_add (idle_garbage_collect_cell_data, cell_info->view);
+           gdk_threads_add_idle (idle_garbage_collect_cell_data, cell_info->view);
       }
   }
 }
index 6f153318e762a1bc8dbde7037793db7333adb6ca..655b876a76290e7bfbbebac9ae9a84ea53931d43 100644 (file)
@@ -54,6 +54,7 @@ struct _GailTreeView
   GtkAdjustment *old_vadj;
   guint         idle_expand_id;
   guint         idle_garbage_collect_id;
+  guint         idle_cursor_changed_id;
   GtkTreePath   *idle_expand_path;
   gboolean      garbage_collection_pending;
 };
index 2e5d5e32d6255deac01f995fafee09b824f064b0..c14989f76aa3b97d3050eb5b5d0c3c9c5a26e454 100644 (file)
@@ -511,15 +511,10 @@ idle_notify_name_change (gpointer data)
   GailWindow *window;
   AtkObject *obj;
 
-  GDK_THREADS_ENTER ();
-
   window = GAIL_WINDOW (data);
   window->name_change_handler = 0;
   if (GTK_ACCESSIBLE (window)->widget == NULL)
-    {
-      GDK_THREADS_LEAVE ();
-      return FALSE;
-    }
+    return FALSE;
 
   obj = ATK_OBJECT (window);
   if (obj->name == NULL)
@@ -530,7 +525,7 @@ idle_notify_name_change (gpointer data)
       g_object_notify (G_OBJECT (obj), "accessible-name");
     }
   g_signal_emit_by_name (obj, "visible_data_changed");
-  GDK_THREADS_LEAVE ();
+
   return FALSE;
 }
 
@@ -562,7 +557,7 @@ gail_window_real_notify_gtk (GObject                *obj,
           window->previous_name = g_strdup (name);
        
           if (window->name_change_handler == 0)
-            window->name_change_handler = g_idle_add (idle_notify_name_change, atk_obj);    
+            window->name_change_handler = gdk_threads_add_idle (idle_notify_name_change, atk_obj);
         }
     }
   else
@@ -825,15 +820,11 @@ update_screen_info (gpointer data)
 {
   int screen_n = GPOINTER_TO_INT (data);
 
-  GDK_THREADS_ENTER ();
-
   gail_screens [screen_n].update_handler = 0;
   gail_screens [screen_n].update_stacked_windows = FALSE;
 
   get_stacked_windows (&gail_screens [screen_n]);
 
-  GDK_THREADS_LEAVE ();
-
   return FALSE;
 }
 
@@ -844,8 +835,6 @@ update_desktop_info (gpointer data)
   GailScreenInfo *info;
   int i;
 
-  GDK_THREADS_ENTER ();
-
   info = &gail_screens [screen_n];
   info->update_desktop_handler = 0;
 
@@ -858,8 +847,6 @@ update_desktop_info (gpointer data)
         }
     }
 
-  GDK_THREADS_LEAVE ();
-
   return FALSE;
 }
 
@@ -887,8 +874,8 @@ filter_func (GdkXEvent *gdkxevent,
               gail_screens [screen_n].update_stacked_windows = TRUE;
               if (!gail_screens [screen_n].update_handler)
                 {
-                  gail_screens [screen_n].update_handler = g_idle_add (update_screen_info,
-                                                                      GINT_TO_POINTER (screen_n));
+                  gail_screens [screen_n].update_handler = gdk_threads_add_idle (update_screen_info,
+                                                                                GINT_TO_POINTER (screen_n));
                 }
             }
         }
@@ -908,8 +895,8 @@ filter_func (GdkXEvent *gdkxevent,
                       info->desktop_changed [j] = TRUE;
                       if (!info->update_desktop_handler)
                         {
-                          info->update_desktop_handler = g_idle_add (update_desktop_info, 
-                                                                     GINT_TO_POINTER (i));
+                          info->update_desktop_handler = gdk_threads_add_idle (update_desktop_info,
+                                                                               GINT_TO_POINTER (i));
                         }
                       break;
                     }